package com.bykj.property.api.controller;

import com.bykj.property.api.service.WxAppHouseService;
import com.bykj.property.api.vo.WxRentHouseSelectVo;
import com.bykj.property.api.vo.WxRentHouseVo;
import com.bykj.property.api.vo.WxSecHouseSelectVo;
import com.bykj.property.api.vo.WxSecHouseVo;
import com.bykj.property.controller.vo.response.RespResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@Api(tags = {"api微信房屋"})
@RestController
@RequestMapping("/api")
public class WxAppHouseController {
    @Autowired
    private WxAppHouseService wxAppHouseService;
    @ApiOperation(value = "获取下拉框列表")
    @RequestMapping(value = "/renthouse/getInfoForSelect", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public RespResult getInfoForSelect() {
        WxRentHouseSelectVo wxRentHouseSelectVo = wxAppHouseService.getInfoForSelect();
        return RespResult.ok(wxRentHouseSelectVo);
    }
    @ApiOperation(value = "获取出租房列表")
    @RequestMapping(value = "/renthouse/getHouses", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public RespResult getHouses(String area,String price,String type) {
        List<WxRentHouseVo> rentHouses = wxAppHouseService.getHouses(area,price,type);
        return RespResult.ok(rentHouses);
    }

    @ApiOperation(value = "获取下拉框列表")
    @RequestMapping(value = "/sechand/getSechandForSelect", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public RespResult getSechandForSelect() {
        WxSecHouseSelectVo wxSecHouseSelectVo = wxAppHouseService.getSechandForSelect();
        return RespResult.ok(wxSecHouseSelectVo);
    }
    @ApiOperation(value = "获取二手房列表")
    @RequestMapping(value = "/sechand/getSecHandHouses", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public RespResult getSecHandHouses(String district,String secArea,String secType) {
        List<WxSecHouseVo> rentHouses = wxAppHouseService.getSecHandHouses(district,secArea,secType);
        return RespResult.ok(rentHouses);
    }
}
